gtkwindow: Minor refactor
authorCarlos Garnacho <carlosg@gnome.org>
Wed, 18 Jan 2023 18:55:31 +0000 (19:55 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Wed, 25 Jan 2023 10:22:40 +0000 (11:22 +0100)
Move the handling of the startup ID to a separate function, since
this will be called from several places.

(cherry-picked from commit 6f01f846dc66a6359a1524ace13377536821dbb0)

gtk/gtkwindow.c

index 5478e893eb81d9779f03e350b7e5b4f3dc709f17..4e341f654bc3a451c8843fe8c44f770a9abffcd2 100644 (file)
@@ -6279,6 +6279,32 @@ popover_map (GtkWidget        *widget,
     }
 }
 
+static void
+gtk_window_notify_startup (GtkWindow *window)
+{
+  GtkWindowPrivate *priv = window->priv;
+
+  if (!disable_startup_notification &&
+      !GTK_IS_OFFSCREEN_WINDOW (window) &&
+      priv->type != GTK_WINDOW_POPUP)
+    {
+      /* Do we have a custom startup-notification id? */
+      if (priv->startup_id != NULL)
+        {
+          /* Make sure we have a "real" id */
+          if (!startup_id_is_fake (priv->startup_id))
+            gdk_notify_startup_complete_with_id (priv->startup_id);
+
+          g_free (priv->startup_id);
+          priv->startup_id = NULL;
+        }
+      else
+        {
+          gdk_notify_startup_complete ();
+        }
+    }
+}
+
 static void
 gtk_window_map (GtkWidget *widget)
 {
@@ -6354,25 +6380,7 @@ gtk_window_map (GtkWidget *widget)
 
   gdk_window_show (gdk_window);
 
-  if (!disable_startup_notification &&
-      !GTK_IS_OFFSCREEN_WINDOW (window) &&
-      priv->type != GTK_WINDOW_POPUP)
-    {
-      /* Do we have a custom startup-notification id? */
-      if (priv->startup_id != NULL)
-        {
-          /* Make sure we have a "real" id */
-          if (!startup_id_is_fake (priv->startup_id))
-            gdk_notify_startup_complete_with_id (priv->startup_id);
-
-          g_free (priv->startup_id);
-          priv->startup_id = NULL;
-        }
-      else
-        {
-          gdk_notify_startup_complete ();
-        }
-    }
+  gtk_window_notify_startup (window);
 
   /* if mnemonics visible is not already set
    * (as in the case of popup menus), then hide mnemonics initially